//
//  MyUnitInfoTableViewCell.m
//  PropertyManager
//
//  Created by TNG on 2018/7/30.
//  Copyright © 2018年 Tng. All rights reserved.
//

#import "MyUnitInfoTableViewCell.h"

@implementation MyUnitInfoTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self creatUI];
    }
    return self;
}

-(void)creatUI
{
//    [self.contentView addSubview:self.img];
    [self.contentView addSubview:self.nameLabel];
    [self.contentView addSubview:self.detailLabel];
    [self.contentView addSubview:self.timeLabel];
}

-(void)send
{
    self.img.backgroundColor = SFMRandColor;
    self.nameLabel.text = @"这是物业名称";
    self.detailLabel.text = @"办公｜24㎡";
    self.timeLabel.text = @"租赁日期:2018-09-08 至 2019-09-08";
}

-(void)sendMyUnitModel:(MyUnitModel *)model
{
    self.img.backgroundColor = SFMRandColor;
    self.nameLabel.text = model.housename;
    self.detailLabel.text = [NSString stringWithFormat:@"%@ | %@",model.zlyt,model.rentarea];
    self.timeLabel.text = [NSString stringWithFormat:@"租赁日期：%@ 至 %@",model.rentstartdate,model.rentenddate];
}

-(UIImageView *)img
{
    if (_img == nil) {
        _img = [[UIImageView alloc] initWithFrame:CGRectMake(20, 22, 109, 67)];
        _img.contentMode = UIViewContentModeScaleAspectFill;
        _img.clipsToBounds = YES;
    }
    return _img;
}

-(UILabel *)nameLabel
{
    //140
    if (_nameLabel == nil) {
        _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 22, WIDTH - 30, 20)];
        _nameLabel.font = font(16);
        _nameLabel.textColor = SFM51;
        _nameLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _nameLabel;
}

-(UILabel *)detailLabel
{
    if (_detailLabel == nil) {
        _detailLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 44, WIDTH - 30, 20)];
        _detailLabel.font = font(11);
        _detailLabel.textColor = SFM51;
        _detailLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _detailLabel;
}

-(UILabel *)timeLabel
{
    if (_timeLabel == nil) {
        _timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 66, WIDTH - 30, 20)];
        _timeLabel.font = font(11);
        _timeLabel.textColor = SFM153;
        _timeLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _timeLabel;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
